package com.dy.design_pattern_study.state_pattern.dome2.entry;

import com.dy.design_pattern_study.state_pattern.dome2.State;
import lombok.Data;

/**
 * @CreateBy zhangdingyi
 * @Date 2023-04-06
 * @Content
 */
public class Context {
    private State state;

    public Context(State state) {
        this.state = state;
    }

    public void Request() {
        state.handle(this);
    }

    public State getState() {
        return state;
    }

    public void setState(State state) {
        this.state = state;
        System.out.println("当前状态 state = " + state.getClass().getSimpleName());
    }
}
